
//
//  Copyright: (C) 2006-2008 by Kandalu Software 
//  London
//  info@kandalu.net
//

#import "AnimatingView.h"

@implementation AnimatingView
- (void)awakeFromNib
{
    NSImage *tempImage;
    NSBundle *mainb = [NSBundle mainBundle];
    NSString *path = [mainb pathForResource:@"kk" ofType:@"pict"];
    
    tempImage = [[NSImage alloc] initWithContentsOfFile:path];
    [self setImage:tempImage];
    [tempImage release];
    [self setOpacity:1.0];
}

- (void)setImage:(NSImage *)newImage
{
    [newImage retain];
    [image release];
    image = newImage;
    [self setNeedsDisplay:YES];
}

- (void)setOpacity:(float)x
{
    opacity = x;
    [self setNeedsDisplay:YES];
}

- (void)drawRect:(NSRect)rect
{
    NSRect r = [self bounds];
    NSPoint p = r.origin;
    [[NSColor whiteColor] set];
    [NSBezierPath fillRect:r];
    if (image)
    {
        [image dissolveToPoint:p fraction:opacity];
    }
}

- (void)dealloc
{
    [image release];
    [super dealloc];
}
@end
